<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
//构造函数方式创建对象
    function Animal(nm){
        this.height=120;
        this.color="black";
        this.name=nm;
    }

    var pig=new Animal("猪");
    pig.aa="bb";
    console.log(pig.aa);
    console.log(pig);
    var dog=new Animal("狗");
    console.log(pig.constructor);
</script>
</body>
</html>